﻿///////////////////////////////////////////////////////////////
// Projet serveur entreprise
// Authors: Pierre Corsini, Guillaume Blanc
// mars 2011
///////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;

using System.Windows.Forms;

namespace InterfaceConseiller
{
    static class Program
    {

        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginForm lf = new LoginForm();
            lf.Validated += new LoginForm.ValidatedEventHandler(loginValidated);

            Application.Run(lf);
        }

        static void loginValidated(LoginForm loginform, string theusername, string thepwd)
        {
            if (DLL.Securite.seConnecter(theusername, thepwd, DLL.Securite.Droit.Conseiller) == null)
            {
                MessageBox.Show("Mauvais identifiants!");
                return;
            }

            loginform.Hide();
            new WinFormConseiller(theusername, thepwd).ShowDialog();
        }
    }
}
